import { requestBefore, responseSuccess, responseFail } from '@/config/request.js';
const request = (options) => {
	let config = requestBefore(options);
	let { baseUrl, url, method = 'get', header, data } = config;
	return new Promise((reslove, reject) => {
		wx.request({
			url: baseUrl + url,
			method,
			header,
			data,
			success: (res) => {
				responseSuccess(res, reslove, reject)
			},
			fail: (res) => {
				responseFail(res, reject)
			}
		})
	});
}

export default request
